package cn.likole.oj.bean;

import org.nutz.dao.entity.annotation.*;
import org.nutz.json.JsonField;

import java.util.Date;

/**
 * Created by likole on 7/23/18.
 * 用户
 */
@Table("user")
@TableIndexes({@Index(fields = "nickname"),@Index(fields = "studentId")})
public class User {

    /**
     * 用户编号
     */
    @Id
    private int userId;

    /**
     * 邮箱
     */
    @Name
    private String email;

    /**
     * 密码
     */
    @Column
    private String password;

    /**
     * 昵称
     */
    @Column
    private String nickname;

    /**
     * qq号
     */
    @Column
    private String qq;

    /**
     * 学号
     */
    @Column
    private String studentId;

    /**
     * 所处阶段
     */
    @Column
    private int stage;

    /**
     * 解决数
     */
    @Column
    private int solved;

    /**
     * 提交数
     */
    @Column
    private int submit;

    /**
     * 语言
     */
    @Column
    private int language;

    /**
     * 教程编号
     */
    @Column
    private int tutorialId;

    /**
     * 注册时间
     */
    @Column
    private Date registerTime;

    /**
     * 教程完成时间
     */
    @Column
    private Date tutorialFinishTime;

    @Column
    @JsonField(ignore = true)
    private byte[] avatar;

    @One(field = "tutorialId")
    private Tutorial tutorial;

    @One(field = "userId")
    private UserInfo userInfo;

    public String getQq() {
        return qq;
    }

    public void setQq(String qq) {
        this.qq = qq;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getStudentId() {
        return studentId;
    }

    public void setStudentId(String studentId) {
        this.studentId = studentId;
    }

    public int getStage() {
        return stage;
    }

    public void setStage(int stage) {
        this.stage = stage;
    }

    public int getSolved() {
        return solved;
    }

    public void setSolved(int solved) {
        this.solved = solved;
    }

    public int getSubmit() {
        return submit;
    }

    public void setSubmit(int submit) {
        this.submit = submit;
    }

    public int getLanguage() {
        return language;
    }

    public void setLanguage(int language) {
        this.language = language;
    }

    public int getTutorialId() {
        return tutorialId;
    }

    public void setTutorialId(int tutorialId) {
        this.tutorialId = tutorialId;
    }

    public Date getRegisterTime() {
        return registerTime;
    }

    public void setRegisterTime(Date registerTime) {
        this.registerTime = registerTime;
    }

    public Date getTutorialFinishTime() {
        return tutorialFinishTime;
    }

    public void setTutorialFinishTime(Date tutorialFinishTime) {
        this.tutorialFinishTime = tutorialFinishTime;
    }

    public byte[] getAvatar() {
        return avatar;
    }

    public void setAvatar(byte[] avatar) {
        this.avatar = avatar;
    }

    public Tutorial getTutorial() {
        return tutorial;
    }

    public void setTutorial(Tutorial tutorial) {
        this.tutorial = tutorial;
    }

    public UserInfo getUserInfo() {
        return userInfo;
    }

    public void setUserInfo(UserInfo userInfo) {
        this.userInfo = userInfo;
    }
}
